@@ -79,8 +79,11 @@ class DistributorInfoAdmin(DeleteModelAdmin, admin.ModelAdmin): |
||
| 79 | 79 |
class LatestAppInfoAdmin(admin.ModelAdmin): |
| 80 | 80 |
list_display = ('latest_adr_version_code', 'latest_adr_version_name', 'latest_adr_app', 'latest_adr_url', 'status', 'created_at', 'updated_at')
|
| 81 | 81 |
list_filter = ('status', )
|
| 82 |
+ readonly_fields = ('status', )
|
|
| 82 | 83 |
|
| 83 | 84 |
def save_model(self, request, obj, form, change): |
| 85 |
+ if not obj.pk and LatestAppInfo.objects.filter(status=True).exists(): |
|
| 86 |
+ return |
|
| 84 | 87 |
obj.latest_adr_version_name = strip(obj.latest_adr_version_name) |
| 85 | 88 |
obj.latest_adr_app = strip(obj.latest_adr_app) |
| 86 | 89 |
obj.latest_adr_url = strip(obj.latest_adr_url) |
@@ -21,7 +21,7 @@ class LatestAppInfoAdmin(admin.ModelAdmin): |
||
| 21 | 21 |
readonly_fields = ('status', )
|
| 22 | 22 |
|
| 23 | 23 |
def save_model(self, request, obj, form, change): |
| 24 |
- if not obj.pk and LatestAppInfo.objects.filter(src=obj.src).exists(): |
|
| 24 |
+ if not obj.pk and LatestAppInfo.objects.filter(src=obj.src, status=True).exists(): |
|
| 25 | 25 |
return |
| 26 | 26 |
obj.latest_adr_version_name = strip(obj.latest_adr_version_name) |
| 27 | 27 |
obj.latest_adr_app = strip(obj.latest_adr_app) |